package cn.edu.scut.sys.vo;

import static javax.persistence.GenerationType.IDENTITY;

import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import cn.edu.scut.sys.json.CustomTimestampSerializer;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

/**
 * Leader entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "leader", catalog = "scoredb")
@JsonIgnoreProperties(value={"hibernateLazyInitializer"}) 
public class Leader implements java.io.Serializable {

	private static final long serialVersionUID = 8145073622233643329L;

	// Fields

	private Long id;
	private User user;
	private String name;
	private Integer level;
	private Timestamp registerTime;
	private Integer sex;
	private Integer status;

	// Constructors

	/** default constructor */
	public Leader() {
	}

	/** full constructor */
	public Leader(User user, String name, Integer level,
			Timestamp registerTime, Integer sex, Integer status) {
		this.user = user;
		this.name = name;
		this.level = level;
		this.registerTime = registerTime;
		this.sex = sex;
		this.status = status;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userId")
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "name", length = 50)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "level")
	public Integer getLevel() {
		return this.level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	@Column(name = "registerTime", length = 19)
	@JsonSerialize(using=CustomTimestampSerializer.class)
	public Timestamp getRegisterTime() {
		return this.registerTime;
	}

	public void setRegisterTime(Timestamp registerTime) {
		this.registerTime = registerTime;
	}

	@Column(name = "sex")
	public Integer getSex() {
		return this.sex;
	}

	public void setSex(Integer sex) {
		this.sex = sex;
	}

	@Column(name = "status")
	public Integer getStatus() {
		return this.status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

}